<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title></title>
<#include "/jeecms_sys/head.html"/>
<script type="text/javascript">
$(function() {
	$("#jvForm").validate();
});
(function ($) {
    var printAreaCount = 0;
    $.fn.printArea = function () {
        var ele = $(this);
        var idPrefix = "printArea_";
        removePrintArea(idPrefix + printAreaCount);
        printAreaCount++;
        var iframeId = idPrefix + printAreaCount;
        var iframeStyle = 'position:absolute;width:0px;height:0px;left:-500px;top:-500px;';
        iframe = document.createElement('IFRAME');
        $(iframe).attr({
            style: iframeStyle,
            id: iframeId
        });
        document.body.appendChild(iframe);
        var doc = iframe.contentWindow.document;
        $(document).find("link").filter(function () {
            return $(this).attr("rel").toLowerCase() == "stylesheet";
        }).each(
                function () {
                    doc.write('<link type="text/css" rel="stylesheet" href="'
                            + $(this).attr("href") + '" >');
                });
        doc.write('<div class="' + $(ele).attr("class") + '">' + $(ele).html()
                + '</div>');
        doc.close();
        var frameWindow = iframe.contentWindow;
        frameWindow.close();
        frameWindow.focus();
        frameWindow.print();
    }
    var removePrintArea = function (id) {
        $("iframe#" + id).remove();
    };
})(jQuery);
//声明一个对象
var xmlHttp;
function createXMLHttpRequest() {
	if (window.ActiveXObject) {
		// 如果是IE，采用这种方式获取
		xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	} else {
		// 非IE采用这种方式获取
		xmlHttp = new XMLHttpRequest();
	}
}
// 发送请求修改打印次数
function execute(url) {
	// 获取请求对象XMLHttpRequest
	createXMLHttpRequest();
	xmlHttp.open("GET", url, true);
	xmlHttp.setRequestHeader("Content-Type",
			"application/x-www-form-urlencoded");// 设置请求头的类型为表单类型
	// xmlHttp.onreadystatechange=callback;//状态信息发生改变调用函数
	xmlHttp.send();
}

// 打印
function print(url, elementId) {
	var element = document.getElementById(elementId);
	if (element != 'undefined' && element != null && element != '') {
		element.disabled = true;
	}
	document.all.WebBrowser.ExecWB(6, 1);
	execute(url);
}

// 直接打印
function pictBridge(url, elementId) {
	var element = document.getElementById(elementId);
	if (element != 'undefined' && element != null && element != '') {
		element.disabled = true;
	}
	document.all.WebBrowser.ExecWB(6, 6);
	execute(url)
}
</script>
<style >
	.divCls{
		margin-top: 5px;
		margin-bottom: 2px;
		width: 300px;
		display: block;
	}
	
</style>
<style media=print>
.Noprint {
	display: none;
}

.PageNext {
	page-break-after: always;
}
</style>
</head>
<body>
	<p  class="Noprint">
			<object id="WebBrowser" width=0 height=0 classid="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></object>
			<input type=button value=打印 onclick='$("#printContent").printArea();' id="print"> 
<!-- 
<input
				type=button value=直接打印 onclick="document.all.WebBrowser.ExecWB(6, 6);" id="directPrint"> <input
				type=button value=页面设置 onclick=document.all.WebBrowser.ExecWB(8,1)>
			<input type=button value=打印预览
				onclick=document.all.WebBrowser.ExecWB(7,1)>
-->
	</p>


<div class="body-box" id="printContent">
<#list orderList as orders>

	<div class="divCls" style="margin-top: 40px;text-align: center;">卡餐</div>
	<div class="divCls">**************************************************</div>
	<#if (orders.address)??>
	<div class="divCls" style="font-size: 18px;font-weight: bold;">${(orders.user.mobile)!}&nbsp;${(orders.consigneeName)!}</div>
	<div class="divCls" style="font-size: 18px;font-weight: bold;">${(orders.consigneeAddr)!}</div>
	<#else>
	<div class="divCls" style="font-size: 18px;font-weight: bold;">${(orders.address.mobile)!}&nbsp;${(orders.address.consigneeName)!}</div>
	<div class="divCls" style="font-size: 18px;font-weight: bold;">${(orders.address.consigneeAddr)!}</div>
	</#if>
	
	<div class="divCls">---------------------------------------------------------------------------</div>
	<div class="divCls">${(orders.orderDate?string("yyyy-MM-dd"))!''}</div>
	<div class="divCls">**************************************************</div>
	<div class="divCls" style="text-align: left;padding-left: 0px;border: 1px solid white;">
	<table align="center" border="0" style="margin-left: 0px">
		<tr><th>商品名称</th><th>数量</th><th>单价（元）</th><th>金额（元）</th></tr>
		<#list orders.mappingSet as mapping>
			<tr>
				<td align="center">${(mapping.product.productName)!}</td>
				<td align="center">${(mapping.buyCount)!}</td>
				<td align="center">${(mapping.productPrice)!}</td>
				<td align="center">${((mapping.buyCount)*(mapping.productPrice))!}</td>
			</tr>
		</#list>
	</table>
	</div>
	<div class="divCls">---------------------------------------------------------------------------</div>
	<div class="divCls" style="text-align: right;font-size: 18px;font-weight: bold;"> 已付款 卡币 ￥ ${orders.cardCoinPrice!0}</div>
	<div class="divCls" style="text-align: right;font-size: 18px;font-weight: bold;">优惠券 ￥ ${orders.couponPrice!0}</div>
	<div class="divCls" style="text-align: right;font-size: 18px;font-weight: bold;">微信支付 ￥ ${orders.totalPrice!0}</div>
	<div class="divCls">---------------------------------------------------------------------------</div>
</#list>
</div>
</body>
</html>